package com.hermes.biz.service.user.impl;

import java.util.List;

import org.apache.log4j.Logger;

import com.hermes.biz.common.model.result.UserCommentResultDO;
import com.hermes.biz.common.model.user.UserCommentDO;
import com.hermes.biz.manager.user.UserCommentManager;
import com.hermes.biz.service.user.UserCommentService;
import com.hermes.biz.service.user.UserMessageService;

public class UserCommentServiceImpl implements UserCommentService {

    private UserCommentManager userCommentManager;

    private UserMessageService userMessageService;

    private Logger             log = Logger.getLogger(UserCommentServiceImpl.class);

    public void saveUserCommentInfo(UserCommentDO userCommentDO) {

        this.userCommentManager.saveUserCommentInfo(userCommentDO);

        this.userMessageService.saveMessageEventInfo(userCommentDO);

    }

    public List<UserCommentDO> getUserCommentInfo(long userId) {

        List<UserCommentDO> userCommentDOs = this.userCommentManager.getUserCommentInfo(userId);

        return userCommentDOs;
    }

    public List<UserCommentDO> getUserCommentInfoByItemId(long itemId) {

        List<UserCommentDO> userCommentDOs = this.userCommentManager
            .getUserCommentInfoByItemId(itemId);
        log.error("getComments-size:" + userCommentDOs.size());
        return userCommentDOs;
    }

    public UserCommentResultDO getUserCommentInfoByCommentId(long commentId) {

        UserCommentResultDO userCommentResultDO = this.userCommentManager
            .getUserCommentInfoByCommentId(commentId);

        return userCommentResultDO;
    }

    public void deleteUserCommentInfo(long userId) {

        this.userCommentManager.deleteUserCommentInfo(userId);

    }

    public void deleteUserCommentInfoByCommentId(long commentId) {

        this.userCommentManager.deleteUserCommentInfoByCommentId(commentId);

    }

    public void deleteUserCommentInfoByitemId(long itemId) {

        this.userCommentManager.deleteUserCommentInfoByitemId(itemId);

    }

    public List<UserCommentDO> getUserCommentInfoByItemIdV2(long itemId) {
        List<UserCommentDO> userCommentDOs = this.userCommentManager
            .getUserCommentInfoByItemIdV2(itemId);
        log.error("getComments-size:" + userCommentDOs.size());
        return userCommentDOs;
    }

    public UserCommentManager getUserCommentManager() {
        return userCommentManager;
    }

    public void setUserCommentManager(UserCommentManager userCommentManager) {
        this.userCommentManager = userCommentManager;
    }

    public UserMessageService getUserMessageService() {
        return userMessageService;
    }

    public void setUserMessageService(UserMessageService userMessageService) {
        this.userMessageService = userMessageService;
    }

}
